/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    var testArr = []
    var numsArr = [...nums]
    for(let i = 0; i < numsArr.length; i++) {
        for(let j = 0; j < numsArr.length; j++) {
            if(j === i) continue
            if(numsArr[i] + numsArr[j] === target) {
                let temp1 = numsArr[i]
                let temp2 = numsArr[j]
                numsArr.splice(numsArr.indexOf(temp1),1)
                numsArr.splice(numsArr.indexOf(temp2),1)
                testArr.push(i, j)
                i = 0
                j = 0
            }
        }
    }
    return testArr
};